package packets.c2spackets;

import network.MCConnection;
import entities.Player;
import exceptions.UnrecoverableException;
import packets.PacketHandler;
import world.WorldState;

/**
 * 0x0B: Player Position
 * 
 *
 */
public class P0x0B extends PacketHandler {

	public P0x0B(WorldState state) {
		super(state);
	}

	@Override
	public void handle(MCConnection conn) throws UnrecoverableException {
		double x = conn.r.readDouble();
		double y = conn.r.readDouble();
		double stance = conn.r.readDouble();
		double z = conn.r.readDouble();
		boolean onground = conn.r.readBoolean();
		
		Player p = conn.getPlayer();
		p.setLocation(x, y, z);
		p.setStance(stance);
		p.setOnGround(onground);
		p.updateLocation(); //TODO: UpdateLocationOnly
	}

}
